<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        const Arr=[111,222,333,444];

        const[a,b,c,d]=Arr;
        console.log(a)
        console.log(b)
        console.log(c)
        console.log(d)
        const[,,,aa]
        console.log(aa);
        const[aaa,...newarr]=Arr//...展开运算符
        console.log(aaa,newarr)

        const Arr1=[1,2,3]
        const newArr1 =Arr1
        newArr1[1]=22
        console.log(Arr1)
        console.log(newArr1)
        const newArr2 =[...arr1]
        newArr2[1]=22
        console.log(arr1)
        console.log(newArr2)

        //合并数组
        const arrA=[1,2,3]
        const arrB=[3,4,5]
        //arrA.concat(arrB)
        const arrC=[...arrA,...arrB]

        //两个值交换
        let a=1
        let b=2
        [a,b]=[b,a]//交换
    </script>
</body>
</html>